import { LOCALSTORAGE_ENUM } from '@/enum/system';
import { defineStore } from 'pinia';

interface Columns {
  show?: boolean;
  title?: string;
  dataIndex: string;
}
interface ColumnsItem {
  columns: Columns[];
  moduleName: string;
}
interface ColumnStore {
  data: ColumnsItem[];
}

/* 系统表格表头,ModuleName必须唯一，否则会冲突 */
const useColumnsStore = defineStore(LOCALSTORAGE_ENUM.COLUMNS, {
  state: (): ColumnStore => ({
    data: [],
  }),
  persist: true,
});

export default useColumnsStore;
